Skip to content

SOLR-18093: Add top-level 'queries' support to JsonQueryRequest in SolrJ#4276

Open
ercsonusharma wants to merge 11 commits intoapache:mainfrom
ercsonusharma:feat_json_query
Open

SOLR-18093: Add top-level 'queries' support to JsonQueryRequest in SolrJ#4276
ercsonusharma wants to merge 11 commits intoapache:mainfrom
ercsonusharma:feat_json_query

Conversation

@ercsonusharma
Copy link
Copy Markdown
Contributor

@ercsonusharma ercsonusharma commented Apr 9, 2026

https://issues.apache.org/jira/browse/SOLR-18093

Description

Currently, JsonQueryRequest in SolrJ supports specifying a single query via setQuery() and other top-level parameters like limit, sort, fields etc.

However, it does not support top-level "queries" blocks, which is a good addition to fully leverage the combined query component and the Additional Queries feature in Solr’s JSON Query DSL. This limitation prevents constructing multiple queries or additional scoring/re-ranking queries in a single JSON request from the client side.

Solution

Added method to pass the required params in JsonQueryRequest. Also, enhanced the documentation.

Tests

Added Unit tests and Integration tests.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

@github-actions github-actions Bot added documentation Improvements or additions to documentation configs client:solrj tests labels Apr 9, 2026
Copy link
Copy Markdown
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this :-)

Comment thread solr/solr-ref-guide/modules/query-guide/examples/JsonRequestApiTest.java Outdated
Comment thread solr/solr-ref-guide/modules/query-guide/examples/JsonRequestApiTest.java Outdated
Comment thread solr/solr-ref-guide/modules/query-guide/examples/JsonRequestApiTest.java Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmmm, not sure what I think about adding another handler to one of only 2 configSets we ship with Solr. But I suppose it's fine as this particular one, techproducts, is to show off features. So sure.

CC @epugh for 2nd opinion.

@ercsonusharma
Copy link
Copy Markdown
Contributor Author

Fixed a flaky test in CombinedQuerySolrCloudTest.java‎ from #4277. @dsmiley - When you have a moment, Would you be able to help here by running the workflows to validate this, and merge it once it passes?

@dsmiley dsmiley self-requested a review April 19, 2026 22:47
</requestHandler>

<initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell,update">
<requestHandler name="/search" class="solr.CombinedQuerySearchHandler">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand you are touching the techproducts config because it's necessary in order to demonstrate RRF. And you seem to have chosen "/search" because 2 other names "/select" and "/query" were chosen. If another feature were to come along, would yet another SearchHandler need to be defined for it with an attempt to find yet another synonym?

Two counter-proposals:
(A) Expand the scope of "/query". It's harmless to use CombinedQuerySearchHandler without any combining. CombinedQuerySearchHandler just means it's capable of combining.
(B) Use "/rrf" instead.
(C) The tutorial/documentation can show how to use our config API to manipulate the config at runtime by adding a handler and component (even in one request). And use a name like "/rrf". You can find this approach for the TaggerHandler: https://solr.apache.org/guide/solr/latest/query-guide/tagger-handler.html#create-and-configure-a-solr-collection

I prefer C. But not as-is with "/search"!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. renamed to /rrf. Will take up the documentation in a follow up change.

@dsmiley
Copy link
Copy Markdown
Contributor

dsmiley commented Apr 21, 2026

LMK when you think it's ready to merge.

I think it's questionable to make the test put all data in one shard... but as long as the combiner is tested in other tests with data across shards, it's okay.

@ercsonusharma
Copy link
Copy Markdown
Contributor Author

ercsonusharma commented Apr 21, 2026

Yes, the combiner is already tested in other tests with data across shards.
I think we should be good to merge once related tests in Solr Tests passes.

@ercsonusharma
Copy link
Copy Markdown
Contributor Author

ercsonusharma commented Apr 22, 2026

David, After going through a long queue, I can see the previous related test cases passing here but last one somehow cancelled. I think we should be good to merge now. @dsmiley

Update: Can see all related tests passed in latest run now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:search client:solrj configs documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants